import "./index.scss";
import { Button, Form, Input } from "antd";
import axios from "../../http/index";

const Login = () => {
  const onFinish = (values: any) => {
    console.log("Success:", values);
    axios({
      url: "/login",
      method: "post",
      data: values,
    });
  };

  const onFinishFailed = (errorInfo: any) => {
    console.log("Failed:", errorInfo);
  };
  return (
    <div className="login">
      <div className="left">
        <h2>Hi,您好</h2>
        <h2>欢迎进入智能仓储管理系统</h2>
      </div>
      <div className="right">
        <h2>Sign in</h2>
        <Form
          name="basic"
          labelCol={{ span: 8 }}
          wrapperCol={{ span: 16 }}
          initialValues={{ remember: true }}
          onFinish={onFinish}
          onFinishFailed={onFinishFailed}
          autoComplete="off"
        >
          <Form.Item
            label="账号:"
            name="username"
            rules={[{ required: true, message: "请输入账号" }]}
          >
            <Input />
          </Form.Item>

          <Form.Item
            label="密码:"
            name="password"
            rules={[{ required: true, message: "请输入密码" }]}
          >
            <Input.Password />
          </Form.Item>
          <Form.Item wrapperCol={{ offset: 8, span: 16 }}>
            <Button type="primary" htmlType="submit">
              登录
            </Button>
          </Form.Item>
        </Form>
      </div>
    </div>
  );
};
export default Login;
